package com.allwees.bs.module.oms.dto;

import com.allwees.bs.core.model.order.wf.refund.ERefundState;
import com.allwees.bs.module.oms.entity.OrderItem;
import com.allwees.core.common.util.reflect.PojoUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

@Data
@Slf4j
public class OmsOrderItemDto implements Serializable {

    private String uuid;

    private String orderUuid;

    private String productUuid;

    private String skuUuid;

    private Boolean reviewAble;

	// 可评价的最后时间
	private Date ratableAt;

	// 评价时间 默认为0
	private Date reviewAt;

	// 购买数量
	private Integer quantity;

	// 价格
	private BigDecimal price;

    //订单总金额
    private BigDecimal amt;

    //Sku总价
    private BigDecimal amtSku;

    //运费
    private BigDecimal amtShipping;

    //退货金额
    private BigDecimal refundMoney;

    //退货id
    private String orderRefundUuid;

    //退货状态
    private ERefundState refundState;

    private OrderProductSnapDto product;

    private OrderSkuSnapDto sku;

    public OmsOrderItemDto() {
    }

    public void setProperties(OrderItem orderItem) {
        PojoUtil.copyWithOmit(this, orderItem, "order", "product", "sku");
    }


    /**
     * 状态文本
     * @return
     */
    public String getRefundStateDesc(){
        if(refundState != null){
            return refundState.getDesc();
        }
        return StringUtils.EMPTY;
    }
}
